type expr =   
  | CstI of int                             //整数
  | CstB of bool                            //布尔值
  | Var of string                           //变量访问
  | Let of string * expr * expr             //声明局部变量
  | Prim of string * expr * expr            //基本运算
  | If of expr * expr * expr                //if表达式
  | Letfun of string * list * expr * expr //函数声明与定义 
  | Call of expr * list                     //函数调用

 type value =   
     | Int of int  
     | Closure of string * list * expr * value env  

let rec eval (e : expr) (env : value env) : int =  
match e with   
| Letfun(f, x, fBody, letBody) ->   
let bodyEnv = (f, Closure(f, x, fBody, env)) :: env   //Closure-->type value 的构造子
in eval letBody bodyEnv                             
| Call(Var f, eArg) ->   
let fClosure = lookup env f                           
in match fClosure with      // Evaluate fBody in declaration environment  
  | Closure (f, x, fBody, fDeclEnv) ->  
    let xVal = Int(eval eArg env)  //Int --> type value 的构造子
    
    let fBodyEnv = (x, xVal) :: (f, fClosure) :: fDeclEnv   
                                    // 将fClosure 保存到fDeclEnv支持定义递归函数
    in eval fBody fBodyEnv  
  | _ -> failwith "eval Call: not a function"  

 System.BitConverter.ToInt32(System.BitConverter.GetBytes(flaot32(1.2)),0)
 System.BitConverter.ToInt64(System.BitConverter.GetBytes(double(1.2)),0)
  System.BitConverter.ToInt32(System.BitConverter.GetBytes(1.2),0)
  System.BitConverter.ToInt32(System.BitConverter.GetBytes(1.2),4)   //小端模式,其实是开头


let (resetLabels, newLabel) =
    let lastlab = ref -1

    ((fun () -> lastlab := 0),
     (fun () ->
         (lastlab := 1 + !lastlab
          "L" + (!lastlab).ToString())))
let labend   = newLabel()  
let labbegin = newLabel()                       //设置label
let labope   = newLabel()  

let s = "1.232f";;
s.[0..s.Length-1];;

let s=[1;2]

let rec fore sb = 
match sb with
  | front ::ende -> 
    
      fore ende
fore s

let a=4.0
let b=4.0f


let (var1, var2) as tuple1 = (1, 2)
printfn "%d %d %A" var1 var2 tuple1


let var1=1
let var2=2
let tuple1 =(var1 ,var2)

System.Single.Parse("4.0f")

Microsoft.FSharp.Core.Operators.box (4.0f)